// NACL MOD TRACK "third_party/nacl-glibc/sysdeps/nacl/llseek.c"

#include <errno.h>
#include <unistd.h>

#include <irt_syscalls.h>


loff_t __llseek (int fd, loff_t offset, int whence) {
  ENOSYS_IF_NULL(__nacl_irt_seek)

  int64_t nacl_offset = offset;
  int result = __nacl_irt_seek (fd, nacl_offset, whence, &nacl_offset);

  if (result != 0) {
    errno = __nacl_abi_errno_to_errno(result);
    return -1;
  }

  return nacl_offset;
}

weak_alias (__llseek, lseek64)